<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="作废原因" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
    function checkeReason(){
        var cancelReason = document.getElementById("cancelReason").value;
		if(cancelReason == null || cancelReason == ""){
		   ShowAlert('提示框','请输入作废原因',200,100);
		   return false;
		}else if(cancelReason!="" && cancelReason.length>500){
		   ShowAlert('提示框','作废原因字数不能超过500个',200,100);
		   return false;
		}else{
		    return true;
		}
    }
	function doSave(){
		if(checkeReason()){
			ShowConfirm('确认框','确定作废吗？',340,80,"doSaveCallBack()");
		}
	}
	function doSaveCallBack(){
		if(popRetVal!=null){
			var cancelReason = document.getElementById("cancelReason").value;
			var id = "${id}";
			var type = "${cancel_type}";
			var url = "";
			if(type == "business"){   //业务单
			   url = "/business/BusinessBillCancel.ihtm";
			}else if(type == "deliver"){
			   url = "/business/DeliverBillCancel.ihtm";
			}else if(type == "receive"){   //收款单
			   url = "/finance/ReceiveBillCancel.ihtm";
			}else if(type == "adjust") {   //调账单
			   url = "/finance/AdjustBillCancel.ihtm";
			}else if(type == "pay"){       //付款单
			   url = "/finance/PayBillCancel.ihtm";
			}else if(type == "cooper"){    //外协单
			   url = "/cooper/CooperBillCancel.ihtm";
			}else if(type == "gather"){    //收货单
			   url = "/cooper/GatherBillCancel.ihtm";
			}else if(type == "purchase"){
			   url = "/purchase/PurchaseBillCancel.ihtm";
			}else if(type == "inBill"){
			   url = "/storehouse/InBillCancel.ihtm";
			}else if(type == "outBill"){
			   url = "/storehouse/OutBillCancel.ihtm";
			}else if(type == "income"){
			   url = "/finance/IncomeBillCancel.ihtm";
			}else if(type == "feeBill"){
			   url = "/finance/FeeBillCancel.ihtm";
			}else if(type == "transfer"){
			   url = "/finance/TransferBillCancel.ihtm";
			}else if(type == "loanBill"){
			   url = "/finance/LoanBillCancel.ihtm";
			}else if(type == "ovBill"){
			   url = "/make/OvBillCancel.ihtm";
			}else if(type == "alloBill"){
			   url = "/storehouse/AlloBillCancel.ihtm";
			}else if(type == "setuBill"){
			   url = "/business/SetuBillCanc.ihtm";
			}else{
				return;
			}
			window.location=url+"?id="+id+"&reason="+encodeURIComponent(cancelReason);
		}
	}
	function doCancel(){
		parent.ClosePop();
	}
	function showMe(){
		showFormErrorMsg();
	}
</script>
</head>
<body oncontextmenu="return false" scroll="no" onLoad="showMe();" class="sheet modal-dialog" style=" padding-top:15px;">
<div class="sheet-main" id="bodyDiv" style="width:850px;">
	  <div class="sheet-list" style="width:100%">
	    <div class="modal-main search-business">
	    	<div style="width:100%;">
				<c:set var="pageTopTitle" value="作废原因" />
				<%@ include file="../inc/PageTop.jsp"%> 
				<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-0">
					<tr>
				      	<th style="width:15%"><span class="MustInput">*</span>作废原因：</th>
				      	<td style="width:85%">
				      		<textarea class="TextBox" style="width:660px;height:80px" id="cancelReason" name="cancelReason"></textarea>
				     	</td>
					</tr>
				</table>
			</div>
	  	</div>
	  </div>
		<div class="modal-buttom" id="buttonDiv">
			<input type="button" class="buttom-a" value="作 废" onClick="doSave();">
			<input type="button" class="buttom-a" value="取 消" onClick="doCancel();">
		</div>
</div>		
</body>
</html>